package com.bo.mapper;

import com.bo.pojo.Emp;
import org.apache.ibatis.annotations.*;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.util.List;

/**
 * @author huangbo
 * @version 1.0.0
 */
@Mapper
public interface EmpMapper {
//    @Select("select count(*) from emp")
//    public Long count();
//
//    @Select("select * from emp limit #{start},#{pageSize}")
//    public List<Emp> page(Integer start, Integer pageSize );

//    @Select("select * from emp")
    public List<Emp> list(String name, Short gender, LocalDate begin,LocalDate end);

    public void delete(Integer[] ids);

    @Insert("insert into emp(username, name, gender, image, job, entrydate, dept_id, create_time, update_time) " +
            "VALUES (#{username}, #{name}, #{gender}, #{image}, #{job}, #{entrydate}, #{deptId}, #{createTime}, #{updateTime})")
    public void insert(Emp emp);    //顺序没要求，只要名字和Emp类的属性名能对上就行

    @Select("select * from tlias.emp where id = #{id}")
    Emp get(Integer id);

    void change(Emp emp);

    @Select("select * from tlias.emp where username=#{username} and password=#{password}")
    Emp getByUsernameAndPassword(Emp emp);

    @Delete("delete from tlias.emp where dept_id = #{deptId}")
    void deletepro(Integer deptId);
}
